
#ifndef __ENTITY_INTERFACE___
#define __ENTITY_INTERFACE___

#include "Entry/LibExportCom.h"
#include "Data/DataExIf.h"
#include "Gene/GeneHostIf.h"
#include "Combat/CombatSysIf.h"
#include "Move/MoveControllerIf.h"
#include "Observer/ObsIf.h"
#include "Message/MsgListenerIf.h"

class IEntityVisitor;
class IEntityManager;
class IScene;

//
//	Entity Interface
//	Entity will have combat system, moving controller, observer and input/output device
//
class TCOM_API  IEntity : public IGeneHost
{
public:
	virtual ~IEntity(){}

	//
	//	callback to load entity datas
	//
	virtual bool	onLoad()	= 0;

	//	
	//	Static ID
	//	ID for static data
	//
	virtual void	setStaticID(int nID)	= 0;
	virtual int		getStaticID()const	= 0;

	//	
	//	ID
	//	ID that in a scene scope
	//	This is an instance id generate when entity enter a scene
	//	It is used frequently for logic between entities in the same scene
	//
	virtual void	setID(int nID)	= 0;
	virtual int		getID()const	= 0;

	//
	//	Global ID
	//	Session ID
	//	Note that not all entity has a global id, only entity that have global interactions 
	//	will have a global id, and only this kind of entity will be managed in a global entity 
	//	mananger. 
	//	
	virtual void	setGlobalID(int nGrpID)	= 0;
	virtual int		getGlobalID()const		= 0;

	//
	//	Entity Type
	//
	virtual short	getType()const	=	0;

	//	
	//	Static ID
	//	ID for static data
	//
	virtual void	setLevel(int v)	= 0;
	virtual int		getLevel()const	= 0;

	//
	//	Entity Name
	virtual void			setName(const string& n) = 0;
	virtual const string&	getName()const = 0;

	//
	//	Position
	//
	virtual void	setPosition(const int& x, const int& y, const int& z) =	0;
	virtual void	getPosition(int& x, int& y, int& z)const	=	0;

	//
	//	Direction
	//
	virtual void	setDirection(const int& x, const int& y, const int& z)	=	0;
	virtual void	getDirection(int& x, int& y, int& z)const	=	0;

	//
	//	Visible
	//
	virtual void	setVisible(const int& v)  = 0;
	virtual int		getVisible()const  = 0;

	//
	//		Entity Global State
	//
	virtual void	setGState(const short& st) = 0;
	virtual short	getGState()const	= 0 ;

	//
	//	Entity Moving System
	//	This act as a move strategy for entity system
	//
	virtual void	setMoveState(const short& st) = 0;
	virtual short	getMoveState()const	= 0 ;

	virtual void				setMoveController(IMoveController* pMC)		= 0;
	virtual IMoveController*	getMoveController()							= 0;

	virtual void	setSpeedModifier(const int& v)	=	0;
	virtual int		getSpeedModifier()const	=	0;

	//
	//	Entity Combat System
	//	This act as a combat strategy for entity system
	//
	virtual void	setCombatState(const short& st) = 0;
	virtual short	getCombatState()const	= 0;

	virtual ICombatSys*	getCombatSys()	= 0;
	virtual void		setCombatSys(ICombatSys* pCombat)	= 0;

	virtual	void		setFaction(short f) = 0;
	virtual	short		getFaction()const = 0;

	//
	//	observer
	//
	virtual void		setObserver(IObs* pObs)	= 0;
	virtual IObs*		getObserver()	= 0;

	//
	//	input and output device
	//
	virtual void		setInputDevice(IMsgListener* pMsgTgt) = 0;
	virtual void		setOutputDevice(IMsgListener* pMsgTgt)  = 0;
	virtual IMsgListener*	getInputDevice() = 0;
	virtual IMsgListener*	getOutputDevice() = 0;


	//
	//		Entity Extension Properties
	//
	virtual	int		getProps(const short& nIdx, int d)const	= 0;
	virtual void	setProps(const short& nIdx, int v)		= 0;

	//
	//		Entity Flags
	//
	virtual void	setFlg(const short& nIdx)	=	0;
	virtual	void	clrFlg(const short& nIdx)	=	0;
	virtual bool	hasFlg(const short& nIdx)	=	0;

	
	//
	//		Static Entity Data
	//
	virtual	IDataEx*	getStaticEntityData()	=	0;
	virtual void		setStaticEntityData(IDataEx* pSED)	=	0;

	//
	//		Entity current scene
	//
	virtual	IScene*		getScene()	= 0;

	//
	//		For entity visitor to visit current interface
	//
	virtual bool	accept(IEntityVisitor& v) = 0;

	//
	//		sub entities management
	//
	virtual IEntityManager*	getEntityMgr() = 0;
};


#endif
